/*****************************************************************************
 * @(#)JCacheUtils.java 1.0.0 2011-4-27 下午05:28:33
 * 
 * Copyright 2011 Thunisoft Co. Ltd.  All rights reserved.
 * THUNISOFT PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 ****************************************************************************/
package com.gmail.huxiaowi.cblog.util;

import java.util.Collections;

import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheFactory;
import javax.cache.CacheManager;

/**
 * Class JCacheUtils
 * 
 * @author  huxw
 * @version $Revision:1.0.0, $Date:2011-4-27 下午05:28:33$
 */
public class JCacheUtils {
    private static Cache cache;
    static {
        try {
            CacheFactory cf = CacheManager.getInstance().getCacheFactory();
            cache = cf.createCache(Collections.EMPTY_MAP);
        }
        catch (CacheException e) {
            e.printStackTrace();
        }
    }
    
    @SuppressWarnings("unchecked")
    public static Object put(Object key, Object value) {
        return cache.put(key, value);
    }
    
    public static Object get(Object key) {
        return cache.get(key);
    }
    
    public static Object remove(Object key) {
        return cache.remove(key);
    }
}
